﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" Inherits="Pages_Reports_ServiceReport" Codebehind="ServiceReport.aspx.cs" %>

<%@ Register TagPrefix="avg" Namespace="Avg.Controls" Assembly="SmartPager" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="using" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="header" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="Server">
    <div style="margin: 5px">
        <asp:Panel ID="panel1" runat="server" DefaultButton="btnSearch" BackColor="White">
            <table id="condition">
                <tr>
                    <td>
                        <h1>
                            Services Report</h1>
                        <div class="description">
                            <b style="color: Red">*</b> Required
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="label">
                            From Date:
                        </div>
                        <div class="field">
                            <asp:TextBox ID="txtFromDate" runat="server" CssClass="datepicker"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="label">
                            To Date:
                        </div>
                        <div class="field">
                            <asp:TextBox ID="txtToDate" runat="server" CssClass="datepicker"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="label">
                            Boat#:
                        </div>
                        <div class="field">
                            <asp:DropDownList ID="ddlBoat" runat="server" AppendDataBoundItems="true">
                                <asp:ListItem Value="">All</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="label">
                            From Serv.Date:
                        </div>
                        <div class="field">
                            <asp:TextBox ID="txtFromServiceDate" runat="server" CssClass="datepicker"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="label">
                            To Serv.Date:
                        </div>
                        <div class="field">
                            <asp:TextBox ID="txtToServiceDate" runat="server" CssClass="datepicker"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="label">
                            Client Type:
                        </div>
                        <div class="field">
                            <asp:DropDownList ID="ddlClientType" runat="server">
                                <asp:ListItem Value="-1">All</asp:ListItem>
                                <asp:ListItem Value="0">Agent</asp:ListItem>
                                <asp:ListItem Value="1">WI</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="label">
                            Service Name:
                        </div>
                        <div class="field">
                            <asp:DropDownList ID="ddlServiceID" runat="server" AppendDataBoundItems="true">
                                <asp:ListItem Value="">All</asp:ListItem>
                                <asp:ListItem Value="0">Meals</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </td>
                    <td>
                        <div class="label">
                            Service Type:
                        </div>
                        <div class="field">
                            <asp:DropDownList ID="ddlServiceType" runat="server">
                                <asp:ListItem Value="-1">All</asp:ListItem>
                                <asp:ListItem Value="1">Shared</asp:ListItem>
                                <asp:ListItem Value="2">Private</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </td>
                    <td>
                        <asp:LinkButton CssClass="button" ID="btnSearch" runat="server" ToolTip="View button"
                            OnClick="btnSearch_Click"><span>Generate</span></asp:LinkButton>
                        <asp:LinkButton CssClass="button" ID="btnReport" runat="server" ToolTip="Print button"
                            OnClick="btnReport_Click"><span>Export summary file</span></asp:LinkButton>
                        <%--<asp:LinkButton CssClass="button" ID="btnSplitReport" runat="server" ToolTip="Split button"
                            OnClick="btnSplit_Click"><span>Export detail file</span></asp:LinkButton>--%>
                        <div style="color: Red">
                            <asp:Literal ID="notify" runat="server" />
                        </div>
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <div id="set1">
            <asp:GridView ID="grv" runat="server" CssClass="grid" AllowSorting="true" AutoGenerateColumns="false"
                Style="border-color: #eaeaea" DataKeyField="BoatID">
                <Columns>
                    <asp:BoundField HeaderText="Boat" DataField="BoatID" HeaderStyle-Width="80" HeaderStyle-HorizontalAlign="Center">
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Departure Date" DataField="DepartureDate" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:d}"></asp:BoundField>
                    <asp:BoundField HeaderText="Route#" DataField="RouteName" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:n0}"></asp:BoundField>
                    <asp:BoundField HeaderText="Booking Code" DataField="ReservationCode" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center"></asp:BoundField>
                    <asp:TemplateField HeaderText="Company Name" HeaderStyle-Width="50" ItemStyle-Font-Bold="true">
                        <ItemTemplate>
                            <a href="#" onclick="javascript:popup('/Pages/Agents/AgentPopup.aspx?AgentID=<%# Eval("GuestID") %>')">
                                <%# Eval("GuestID") %></a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="# of Pax" DataField="NumOfPax" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:n0}"></asp:BoundField>
                    <asp:BoundField HeaderText="Service" DataField="ServiceName" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center"></asp:BoundField>
                    <asp:BoundField HeaderText="Amount" DataField="Amount" HeaderStyle-Width="80" HeaderStyle-HorizontalAlign="Center"
                        DataFormatString="{0:#,##0.##}" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                    <asp:BoundField HeaderText="Currency" DataField="CurrencyName" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                    <asp:BoundField HeaderText="Rate/ Meals" DataField="Meals" HeaderStyle-Width="80"
                        ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.##}" HeaderStyle-HorizontalAlign="Center">
                    </asp:BoundField>
                    <asp:BoundField HeaderText="Total" DataField="Total" HeaderStyle-Width="80" ItemStyle-HorizontalAlign="Right"
                        DataFormatString="{0:#,##0.##}" HeaderStyle-HorizontalAlign="Center"></asp:BoundField>
                    <asp:BoundField HeaderText="Type" DataField="ServiceTypeName" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center"></asp:BoundField>
                    <asp:BoundField HeaderText="Service Date" DataField="ServiceDate" HeaderStyle-Width="80"
                        HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:d}"></asp:BoundField>
                </Columns>
                <HeaderStyle CssClass="gridheader" />
                <RowStyle CssClass="gridrow" />
                <AlternatingRowStyle CssClass="alternatingrow" />
            </asp:GridView>
            <avg:SmartPager ID="smartPager" runat="server" Visible="false" NavigatePreviousText="« Previous"
                NavigateNextText="Next »">
            </avg:SmartPager>
        </div>
        <h1>
            Select provider to export report</h1>
        <div>
            <asp:GridView ID="grdProvider" runat="server" CssClass="grid" AllowSorting="true"
                AutoGenerateColumns="false" Style="border-color: #eaeaea" DataKeyField="ProviderNumber">
                <Columns>
                    <asp:BoundField HeaderText="ProviderID" DataField="ProviderID" Visible="false" />
                    <asp:TemplateField HeaderText="Provider Name" HeaderStyle-Width="100" ItemStyle-Font-Bold="true">
                        <ItemTemplate>
                            <a href="<%# Eval("Url") %>">
                                <%# Eval("ProviderName")%></a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="Bookings" DataField="Bookings" HeaderStyle-Width="10" />
                    <asp:BoundField HeaderText="Item Count" DataField="ItemCount" HeaderStyle-Width="20" />
                </Columns>
                <HeaderStyle CssClass="gridheader" />
                <RowStyle CssClass="gridrow" />
                <AlternatingRowStyle CssClass="alternatingrow" />
            </asp:GridView>
        </div>
    </div>

    <script type="text/javascript">
        $(function () {

            // Datepicker
            $(".datepicker").datepicker({
                constrainInput: true,
                onSelect: function () { }
            });

        });

        function popup(link) {
            testwindow = window.open(link, "mywindow", "location=1,status=1,scrollbars=1,width=640,height=500");
            testwindow.moveTo(0, 0);
        }  

    </script>

</asp:Content>
